﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DemoObject;
using BusinessObjects;

public partial class Module_Video_Controls_VideoRamdom : System.Web.UI.UserControl
{
    public string VideoCategoryTextId { get; set; }
    public Guid? VideoCategoryId { get; set; }
    public string VideoTextId { get; set; }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request["VideoCategoryTextId"] != null)
            {
                VideoCategoryTextId = Request["VideoCategoryTextId"];
                TblVideoCategories item = TblVideoCategoriesRepository.CreateInstant().SelectOne(VideoCategoryTextId);
                if (item != null)
                    VideoCategoryId = item.Id;
                else VideoCategoryId = null;
            }
            if (Request["VideoTextId"] != null)
            {
                VideoTextId = Request["VideoTextId"];
            }
            HashSet<string> hs = new HashSet<string>();
            //hs.Add("newid() DESC");
            int count = 0;
            rpt.DataSource = TblVideoRepository.CreateInstant().SelectListItem(null, VideoCategoryId, null, "", "", "", null, true, null, hs).Where(n => !n.TextId.ToLower().Equals(VideoTextId)).ToList();
            rpt.DataBind();
        }
    }
}
